<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/common/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>表格-列表</title>
<link href="<%=path %>/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=path %>/js/jquery.js"></script>
<script type="text/javascript" src="<%=path %>/js/common.js"></script>
<script type="text/javascript">
/*
 *_contextPath:上下文路径
 *_modulePath: 模块路径
 */
var  _contextPath="<%=path%>";
var  _modulePath=_contextPath+"/sys/";
$(document).ready(function(){
  $(".clicks").click(function(){
   _open(_modulePath+"textures_open.action?view=add");
  });
});
</script>
<script type="text/javascript">
	//删除
	$(document).ready(function(){
			var userId;
			var url;
  			$(".tablelinkdelete").click(function(){
  			userId= $(this).attr("idValue");
            
 			url =" <%= basePath%>/biz/SysUser_delete.action?userId="+userId;
 			 $(".tip").fadeIn(200);
 			 });
  
 			 $(".tiptop a").click(function(){
 			 $(".tip").fadeOut(200);
			});

  			$(".sure").click(function(){
  			$(".tip").fadeOut(100);
  					window.location.href=url;
			});

				  $(".cancel").click(function(){
				  $(".tip").fadeOut(100);
				});
		
	});
	
	$(function(){
$("#userCollege").change(function(){     
        $.ajax({
          timeout: 3000,
          async: false,
          type: "post",
          url: "<%=path%>/biz/SysUser_MajortoJson.action",
          dataType:"json",
          data: {
           userCollege: $("#userCollege").val()
        },
        success: function (jsonData) {
          $("#userMajor").find("option").remove();
           $("#userClass").find("option").remove();
          $("#userMajor").append("<option value=''>-------------请选择专业--------</option>");
          $("#userClass").append("<option value=''>-------------请选择班级--------</option>");
          $(jsonData).each(function (key) {
          
          
          var opt = $("<option></option>").text(jsonData[key].majorName).val(jsonData[key].majorId);
                         
                         $("#userMajor").append(opt);
                        
       });
   
    }
        }); 
     });
     
      $("#userMajor").change(function(){
	     $.ajax({
		     timeout:3000, // 有效时间3s
		     async: false,//是否异步
		     type: "post",//提交表单的类型
		     url:"<%=path%>/biz/SysUser_ClasstoJson.action",//返回班级的json类型
		     dataType:"json",//返回的数据类型
		     data:{
		     userMajor:$("#userMajor").val()//把专业的Id传回后台进行查询	      
	     },
	     success:function(data)
	     {
		      $("#userClass").find("option").remove(); 
		      $("#userClass").append("<option value=''>-------------请选择班级--------</option>");
		      $(data).each(function (key) {
		      
		      
			      var opt = $("<option></option>").text(data[key].className).val(data[key].className);
			      $("#userClass").append(opt);	
			            
		     });
     }
     
     });
     
     });
     
     

     
     
     
     
});
	
	
	
</script>

<style type="text/css">
.tablelinkdelete{color:#056dae;}
</style>
</head>
<body>
	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    <li><a href="#">用户管理</a></li>
    <li><a href="#">用户列表</a></li>
    </ul>
    </div>
<div class="formbody">
    <div id="usual1" class="usual">
      <div id="tab2" class="tabson">
       
        </ul>
        </form> 
       <form action="<%= basePath%>/biz/SysUser_openList.action" method="post"  target="rightFrame">
    	<ul class="seachform">
    	<li><label>学院</label>
    	<select name="userCollege"  id ="userCollege" class="dfselect">
				   <option value="">----------请选择院系---------</option>
					    <s:iterator value="academyList">
					    <option value="${academyId}">${academyName}</option>
					    </s:iterator>
				    </select>
    	</li>
    	<li><label>专业</label>
    	<select name="userMajor"  id ="userMajor" class="dfselect">
				   <option value="">-------------请选择专业--------</option>
				   <s:iterator value="majorList">
			        
			        <option id="" value="${majorId }">${majorName }</option>
			        <!--紧接着的这个option 的id为majorId
			        
			        -->
			        </s:iterator>
				</select>
    	</li>
    	<li><label>班级</label>
    	<select name="userClass"  id ="userClass" class="dfselect">
				   <option value="">-------------请选择班级--------</option>
				   <s:iterator value="SerCalss">
			        
			        <option id="" value="${classId }">${className }</option>
			        <!--紧接着的这个option 的id为majorId
			        
			        -->
			        </s:iterator>
				</select>
    	</li>
    	<li><label>姓名</label><input class="scinput" name="userName"  id="userName"  placeholder="请输入姓名"/></li>  
    	<li><label>类别</label>
    	 <select id="userType" name="userType"   class="scinput">
			        <option value="">请选择...</option>
					<option value="0">学生</option>
					<option value="1">教师</option>
					<option value="9">超级管理员</option>
			    	</select></li> 
    	<li><label>研究室</label>
    	<select name="userStudio"  id ="userStudio" class="dfselect">
				   <option value="">----------请选择研究室---------</option>
					    <s:iterator value="SerStusdio">
					    <option value="${studioName}">${studioName}</option>
					    </s:iterator>
				    </select></li> 
 
            <li><input name="" type="submit" class="scbtn" value="查询"/></li>
          
        </ul>
        </form>  
        
    <table class="tablelist">
    	<thead>
    	<tr>
        <th><input name="" type="checkbox" value="" checked="checked"/></th>
        <th>&nbsp;&nbsp;&nbsp;序号</th>
        <th>&nbsp;&nbsp;&nbsp;用户名</th> 
        <th>&nbsp;&nbsp;&nbsp;姓名</th>
        <!-- <th>性别</th> -->
         <th>&nbsp;&nbsp;&nbsp;学院</th>
         <th>&nbsp;&nbsp;&nbsp;专业</th>
          <th>&nbsp;&nbsp;&nbsp;班级</th>
          <th>&nbsp;&nbsp;&nbsp;科室</th>
        <th>&nbsp;&nbsp;&nbsp;用户类型</th>
       <!--  <th>联系方式</th> -->
       
       
        <th>&nbsp;&nbsp;&nbsp;操作</th>
        </tr>
        
        </thead>
        <tbody>
        <s:iterator value="pageResult.data">
        <tr>
        <td><input name="" type="checkbox" value="" /></td>
        <td>${id}</td>
        <td>${userId}</td>
        <td>${userName}</td>
        <%-- <c:choose>
	        <c:when test="${0 == userSex}">
	        	<td>女</td>
	        </c:when>
	        <c:when test="${1 ==userSex}">
	        	<td>男</td>
	        </c:when>
        </c:choose>  --%>
        <td>${userCollege}</td>
        <td>${userMajor}</td>
        <td>${userClass}</td>
        <td>${userStudio}</td>
        <td>
        <c:choose>
        <c:when test="${userType == 0}">学生</c:when>
        <c:when test="${userType == 1}">教师</c:when>
        <c:when test="${userType == 8}">管理员</c:when>
        <c:when test="${userType == 9}">超级管理员</c:when>
        </c:choose>
        
        
        
        </td>
       <%--  <td>${userPhone}</td> --%>
       	
        
       
        <td>&nbsp;
        		<a href="javascript:;" class="tablelinkdelete" idValue="${userId}">删除</a>&nbsp;&nbsp;
        		<a href="<%= basePath%>/biz/SysUser_openEdit.action?sysUser.userId=${userId}" class="tablelink">详情</a>
        	<!-- 	<a href="<%= basePath%>/biz/SysUser_openDetails.action?sysUser.userId=${userId}" class="tablelink">详情</a> -->
       	 </td>   
        </tr> 
        </s:iterator>
        </tbody>
    </table>
  </div>  
       
	</div>
    
    <!-- 分页菜单组件--------------------------开始 -->
<%
//查询的url地址，统一写
String listActionURL = basePath+"/biz/SysUser.action";
%>
 
    <script type="text/javascript">
//分页组件
function change()
  {
  var url = "<%= basePath%>/biz/SysUser_openList.action";                 //获取表单url
 	var textfield=document.getElementById("textfield").value;
 	var totalPage='${pageResult.totalPage}';
 	var pageNum = 0;
 	if(totalPage*1 >= textfield*1){
 		pageNum = textfield; 
 		 window.location.href  = url+"?page="+pageNum;
 	}else{
 		pageNum = totalPage; 
 		alert("当前只有"+totalPage+"页");
 	}
  	
  }
</script>
<script type="text/javascript">
var url = "<%= basePath%>/biz/SysUser_openList.action";                 //获取表单url
//首页
function first(){
	
   window.location.href  = url+"?page=1";
}
//上一页
function previous(){
    window.location.href  = url+"?page=${pageResult.previousPageNumber}";
}
//下一页
function next(){
    window.location.href  = url+"?page=${pageResult.nextPageNumber}";
}
//尾页
function last(){
  window.location.href  = url+"?page=${pageResult.totalPage}";
}

</script>

<style type="text/css">
.right{  
  height: 28px;  
  text-align: center; 
  line-height: 30px; 
  color:#056dae;
  font-style:normal;
  }

</style>
    <div class="pagin">
    	<div class="message">共<i class="blue">${pageResult.total}</i>条记录 	<i class="blue">${pageResult.totalPage}</i>页， 	当前显示第&nbsp;<i class="blue">${pageResult.page}</i>页</div>
        <ul class="paginList">
           <c:choose>
			   <c:when test="${pageResult.isFirst==true}"><li class="paginItem current"><a href="javascript:;">首页</a></li></c:when>
		       <c:otherwise>
			       <li class="paginItem"><a href="javascript:first()" target="rightFrame">首页&nbsp;</a></li>
		       </c:otherwise>
		   </c:choose>
           <c:choose>
		      <c:when test="${pageResult.isFirst==true}"><li class="paginItem current"><a href="javascript:;">上一页</a></li></c:when>
		      <c:otherwise>
			      <li class="paginItem"><a href="javascript:previous()" target="rightFrame">上一页&nbsp;</a></li>
		      </c:otherwise>
		   </c:choose>
           <c:choose>
			   <c:when test="${pageResult.hasNext==true}">
				   <li class="paginItem"><a href="javascript:next()" target="rightFrame">下一页&nbsp;</a></li>
			   </c:when>
		       <c:otherwise><li class="paginItem current"><a href="javascript:;">下一页</a></li></c:otherwise>
		   </c:choose>
           <c:choose>
			   <c:when test="${pageResult.isLast==true}"><li class="paginItem current"><a href="javascript:;">尾页</a></li></c:when>
		       <c:otherwise>
			       <li class="paginItem"><a href="javascript:last()" target="rightFrame">尾页&nbsp;</a></li>
		       </c:otherwise>
		   </c:choose>
         <li class="paginItem-page">
           跳转到：&nbsp;
          <input name="textfield" type="text" size="4" class="page-input" id="textfield" onchange="change()" />&nbsp;页 &nbsp;&nbsp;<a href="javascript:change()" class="right">确定&nbsp;</a>
        </li>
        </ul>
    </div>
<!-- 分页菜单组件--------------------------结束 -->
<script type="text/javascript"> 
      $("#usual1 ul").idTabs(); 
    </script>
    
    <script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
	</script>
</div>
	  <div class="tip">
    	<div class="tiptop"><span>提示信息</span><a></a></div>
        <div class="tipinfo">
        <span><img src="<%= basePath%>images/ticon.png" /></span>
        <div class="tipright">
        <p>是否确认删除信息 ？</p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
        </div>
        </div>
        
        <div class="tipbtn">
        <input name="" type="button"  class="sure" value="确定" />&nbsp;
        <input name="" type="button"  class="cancel" value="取消" />
        </div>
    
    </div>
</body>

</html>
